package bavaria.hightech.banking.gui;

import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 * A panel that is loaded into th econtentWrapper JPanel. Displays a form to
 * enter the recipient account, the amount and the transfer button
 * 
 * @author Dietmar
 */
public class PanelTransfer {

	private GlobalVarsContainer cont;

	public PanelTransfer(GlobalVarsContainer cont) {
		this.cont = cont;
	}

	public JPanel getJPanel() {

		JPanel panel = new JPanel();

		JLabel accNrToLabel = new JLabel("Recipient account: ");
		JTextField accNrToTextField = new JTextField();
		JLabel amountLabel = new JLabel("Amount: ");
		JTextField amountTextField = new JTextField();
		JButton button = new JButton("Transfer!");

		accNrToTextField.setColumns(13);
		amountTextField.setColumns(13);

		button.addActionListener(new ListenerTransferButton(accNrToTextField,
				amountTextField, cont));

		panel.add(accNrToLabel, BorderLayout.NORTH);
		panel.add(accNrToTextField, BorderLayout.NORTH);
		panel.add(amountLabel, BorderLayout.NORTH);
		panel.add(amountTextField, BorderLayout.NORTH);
		panel.add(button, BorderLayout.NORTH);

		return panel;
	}
}
